The Object Number attribute in full is 3.1.7.2.4.1 I want it to return just 3 The only way I can see of doing this is to find the first non-alphanumeric character and strip away everything from there to the end. Is that really the way to do it, or is there an attribute value for "Section Number" or similar ? Dartguru - Tue Aug 02 10:34:50 EDT 2016 |
Re: Obtaining Section Number for an Object Check this out: https://www.ibm.com/developerworks/community/forums/html/topic?id=9fcfb0d5-187e-4d5a-8838-52da85aaed32&ps=25 |
Re: Obtaining Section Number for an Object The function number returns a string and a string is an array of characters. You get the first character of the array by indexing it with zero (this returns a character, not a string so in the example I have to concatenate with an empty string to get it displayed) So in Layout DXL
|
Re: Obtaining Section Number for an Object PekkaMakinen - Wed Aug 03 01:13:27 EDT 2016 The function number returns a string and a string is an array of characters. You get the first character of the array by indexing it with zero (this returns a character, not a string so in the example I have to concatenate with an empty string to get it displayed) So in Layout DXL
How about for sections higher than 9? Regexp sectionNum = regexp2 "([0-9]+)\\." string objNum = number(obj) if (sectionNum(objNum)) display objNum[match 1]
|
Re: Obtaining Section Number for an Object Antonio__Norkus - Wed Aug 03 08:00:19 EDT 2016
How about for sections higher than 9? Regexp sectionNum = regexp2 "([0-9]+)\\." string objNum = number(obj) if (sectionNum(objNum)) display objNum[match 1]
Yes, you are correct, that is a better solution |
Re: Obtaining Section Number for an Object Antonio__Norkus - Wed Aug 03 08:00:19 EDT 2016
How about for sections higher than 9? Regexp sectionNum = regexp2 "([0-9]+)\\." string objNum = number(obj) if (sectionNum(objNum)) display objNum[match 1]
Excellent Antonio, that's exactly what I was after. |
Re: Obtaining Section Number for an Object I'd just do it with intOf: print intOf(number(o)) That avoids the overhead of creating and deleting a regexp |